<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
</head>
<style>

</style>
<body>
    <div id="app">
        <button @click="start" :disabled="isDisabled">浪起来</button>
        <button @click="pause" :disabled="!isDisabled">低调</button>
        <div>{{msg}}</div>
    </div>
</body>
<script>

    const vm = new Vue({
        el: '#app',
        data: {
            msg: '猥琐发育，别浪~~~~~~~~~~~~~',
            timer: null,
            isDisabled: false,
        },
        methods: {
            start() {
                this.isDisabled = !this.isDisabled;
                this.timer = setInterval(() => {
                    this.msg = this.msg.substring(1) + this.msg[0]
                }, 100)

            },
            pause() {
                this.isDisabled = !this.isDisabled;
                clearInterval(this.timer);
            }
        }
    })
</script>

</html>